<?php
class STE_Page extends STE_Db
{
	// Lấy danh sách trang
	public function getPageList()
	{
		try
		{
			$query = sprintf("CALL sp_admin_get_page_list()");
			$news = $this->_db->fetchAll($query);
			$this->_db->closeConnection();
			return $news;
		}
		catch (Exception $ex)
		{
			throw $ex;
		}
	}

	// Cập nhật trang vào database
	public function editPage($pageID, $languageID, $content)
	{
		try
		{
			$pageLanguageInfo = array();
			$pageLanguageInfo["content"] = $content;
			return $this->_db->update("page_language", $pageLanguageInfo, "pageID=" . $pageID . " AND languageID=" . $languageID);
		}
		catch (Exception $ex)
		{
			throw $ex;
		}
	}

	// Lấy thông tin trang
	public function getPage($pageID, $languageID = 1)
	{
		try
		{
			$query = sprintf("CALL sp_admin_get_page(%u, %u)", $pageID, $languageID);
			$page = $this->_db->fetchRow($query);
			$this->_db->closeConnection();
			return $page;
		}
		catch (Exception $ex)
		{
			throw $ex;
		}
	}
}
?>